package br.com.foxinline.servico;

import br.com.foxinline.modelo.Averbacao;
import br.com.foxinline.modelo.Imovel;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;



/**
 *
 * @author cadomeireles
 */
@Stateless
public class AverbacaoServico extends ServicoGenerico<Averbacao> {
    
    public AverbacaoServico() {
        super(Averbacao.class);
    }
    
    public List<Averbacao> pesquisar(Imovel imovel) {

        String sql = "select imovel.averbacoes from Imovel imovel where imovel = :imovel";
        
        Query query = getEntityManager().createQuery(sql);
        
        if (imovel != null && imovel.getId() != null) {
            query.setParameter("imovel", imovel);
        }

        return query.getResultList();

    }
    
}
